package org.wlgzs.shop.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wlgzs.shop.bean.OrderPersonData;
import org.wlgzs.shop.bean.OrderPersonDataExample;
import org.wlgzs.shop.dao.OrderPersonDataMapper;
import org.wlgzs.shop.dao.OrderTransportDataMapper;
import org.wlgzs.shop.service.IOrderPersonDataService;

import java.util.List;

/**
 * @Author: Ben
 * @Date: 2019/5/22 20:46
 * @Project org.wlgzs.shop
 */
@Service(value ="OrderPersonData" )
public class OrderPersonDataServiceImpl implements IOrderPersonDataService {
    @Autowired
    OrderPersonDataMapper orderPersonDataMapper;

    /**
     * 增加订单用户信息
     * @param orderPersonData
     * @return int
     */
    @Override
    public int insertOrderPersonDataService(OrderPersonData orderPersonData) {
        return orderPersonDataMapper.insert(orderPersonData);
    }

    /**
     * 根据订单id删除订单用户信息
     * @param orderId
     * @return int
     */
    @Override
    public int deleteOrderIdOrderPersonDataService(int orderId) {
        return orderPersonDataMapper.deleteByPrimaryKey(orderId);
    }

    /**
     * 根据订单id更改订单用户信息
     * @param orderPersonData
     * @return int
     */
    @Override
    public int updateOrderIdOrderPersonDataService(OrderPersonData orderPersonData) {
        return orderPersonDataMapper.updateByPrimaryKeySelective(orderPersonData);
    }

    /**
     * 根据订单id查询订单信息
     * @param orderId
     * @return
     */
    @Override
    public List<OrderPersonData> selectOrderIdOrderPersonDataService(int orderId) {
        OrderPersonDataExample orderPersonDataExample=new OrderPersonDataExample();
        OrderPersonDataExample.Criteria criteria=orderPersonDataExample.createCriteria();
        criteria.andOrderIdEqualTo(orderId);
        List<OrderPersonData> orderPersonDataList=orderPersonDataMapper.selectByExample(orderPersonDataExample);
        return orderPersonDataList;
    }
}
